package com.css.fxfzxczh.util;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: XZY
 * @CreateTime: 2023/11/20 11:04
 * @Description: 手动分页工具类
 */
public class HandMovementPageUtil {
    public static <T> List<T> startPage(List<T> list, Integer pageNum, Integer pageSize) {
        if (list == null || list.isEmpty()) {
            return new ArrayList<>();
        }

        int count = list.size();
        int fromIndex = (pageNum - 1) * pageSize;
        int toIndex = Math.min(fromIndex + pageSize, count);

        return list.subList(fromIndex, toIndex);
    }
}
